package vista;

import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics;
import java.util.Observable;
import java.util.Observer;

import javax.swing.ImageIcon;
import javax.swing.JLabel;
import javax.swing.JPanel;
import model.ModeloObsrvable;
import java.awt.BorderLayout;

public class VistaPanel2 extends JPanel implements Observer {
	
	
	private static final long serialVersionUID = -1917791561676036044L;
	private ModeloObsrvable modelo;

	public VistaPanel2(ModeloObsrvable modelo) {
		this.modelo = modelo;
		this.modelo.addObserver(this);
		
		setBounds(10, 501, 650, 200);
		setLayout(new BorderLayout(0, 0));
				
	}

	@Override
	public void update(Observable o, Object arg) {
		removeAll();
		repaint();
	}
	
	public void paintComponent(Graphics grafico) {	
		
		super.paintComponent(grafico);
		
		JLabel lblHolis = new JLabel(new ImageIcon(VistaPanel2.class.getResource("/vista/imagenes/policia.jpg")));
		add(lblHolis, BorderLayout.WEST);
		
		JLabel txtpnTextoTextoY = new JLabel();
		txtpnTextoTextoY.setOpaque(false);
		txtpnTextoTextoY.setFont(new Font("Arial Black", Font.BOLD | Font.ITALIC, 26));
		txtpnTextoTextoY.setBackground(Color.WHITE);
		add(txtpnTextoTextoY, BorderLayout.CENTER);
		txtpnTextoTextoY.setText("<html>POLICIA:  "+modelo.getPoliciaNombre()+" <br/>GRADO:  "+modelo.getPoliciaGrado()+"<br/>"+modelo.getPoliciaDia()+", "+modelo.getPoliciaHoraComoString()+" hs</html>");
		
		setVisible(true);
	}

}
